//
//  Type.swift
//  Demo
//
//  Created by S JZ on 2024/7/26.
//

import Foundation

public protocol CellType {
    associatedtype D
    var data: D? { get set }
    var indexPath: IndexPath { get set }
    var cellHeight: CGFloat { get set }
}

open class CellData<D>:NSObject, CellType where D: Any {
    open var data: D?
    open var cellType: (any Hashable)?
    open var cellHeight: CGFloat = 0
    open var indexPath: IndexPath = IndexPath(row: 0, section: 0)
    
    init(data: D? = nil, 
         cellType: (any Hashable)? = nil,
         cellHeight: CGFloat = 0,
         indexPath: IndexPath = IndexPath(row: 0, section: 0)) {
        self.indexPath = indexPath
        self.cellHeight = cellHeight
        self.data = data
        self.cellType = cellType
    }
}

open class SectionData: NSObject {
    open var section: Int = 0
    open var heardHeight: CGFloat = 0.01
    open var footerHeight: CGFloat = 0.01
    open var cellDataList: [any CellType] = []
}
